<?php
/**
 * IndexController - The default controller class
 *
 * @author
 * @version
 */
require_once 'Zend/Controller/Action.php';
class IndexController extends App_Zend_Controller_Action_Shop
{
	public function init()
	{
		$this->view->styleName = 'index';	
		$this->view->select = 'cur';
	}
	
    public function indexAction()
    {
    	//一些配置参数
    	$cateString = file_get_contents(MY_ROOT.'/html/upload/category/category.txt');
        $cateArray = array();
        if ($cateString != '') {
            $cateArray = json_decode($cateString,true);
        }
        $item = new CItem();
        $isHotItemArray=$item->getAllItems(0,$cateArray['hot_cate'],'product',0,0,"has_banned","type='1' and is_showed=1 and onsales=0",'px ASC,view_num DESC');
        $this->view->assign('isHotItemArray',$isHotItemArray);
        $this->getHelper('Fenlei')->getCategories();        

        $imgString=file_get_contents(MY_ROOT.'/html/upload/turn_round/imgs.txt');
		$imgArray=array();
		$imgArray=json_decode($imgString,true);		
		
		$orderArr1 = $imgArray['ordering'];
		$orderArr2 = $imgArray['ordering'];
		
		array_multisort($orderArr1, $imgArray['imgUrl']);
		array_multisort($orderArr2, $imgArray['imgHref']);
		
		$this->view->assign('imgArray',$imgArray);        
		
        $this->view->webSiteTitle = 'Cheap Soccer Jerseys, Soccer Jersey Deals, club football shirt and football kit online Free Shipping on all orders';
        $this->view->webSiteKeywords = 'Soccer jersey,football shirt,soccer kits, soccer shirts,cheap football shirts, football jersey';
        $this->view->webSiteDescription = 'bestcheapjerseydeal.com offers a variety of soccer jerseys, football shirts ,football kits, 2014 world cup jersey and kids football kit with nice price.';

        $this->view->home = 1;
		
		$this->view->assign('isOurOwnProduct',1);
    }



    public function getlocationajaxAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $this->getHelper ('layout')->disableLayout ();

        $pid=$this->_request->getParam('pid',0);

        $location=new CFenlei('location');

        $fenleiArray=$location->getFenleiByPid($pid);

        echo json_encode($fenleiArray);

    }

    public function userpanelAction()
    {

        $this->getHelper('User')->getinfo($this->_request->getModuleName(),$this->_request->getControllerName());

        $this->getHelper ('layout')->disableLayout ();

    }


    public function postAction()
    {

    //$this->_helper->viewRenderer->setNoRender();

    //$this->getHelper ('layout')->disableLayout ();

    }
    
    public function faceAction()
    {
    	$this->getHelper('layout')->setLayout('facebooklayout');
    	$this->view->styleName = 'index-face';
    	
    	//BEST SELLER
    	$item = new CItem();
        $isHotItemArray=$item->getAllItems(0,$cateArray['hot_cate'],'product',0,0,"has_banned","type='1' and is_showed=1",'px ASC,view_num DESC');
        $this->view->assign('isHotItemArray',$isHotItemArray);
    	
    }

	public function hotsearchclickAction()
	{
		$this->_helper->viewRenderer->setNoRender();

        $this->getHelper ('layout')->disableLayout ();
/*
        $id=$this->_request->getParam('id',0);
        
        if($id>0)
        {
        	$hs = new CHotSearch();
        	$hs->clickHotSearch($id);
        }else { die(); }*/
        die();
	}



}
